package com.wym.charging.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wym.charging.common.Result;
import com.wym.charging.dto.PageDto;
import com.wym.charging.entity.PowerStrip;
import com.wym.charging.service.PowerStripService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 排插表(PowerStrip)表控制层
 *
 * @author WangYimin
 * @since 2024-12-08 22:40:49
 */
@Tag(name = "排插")
@RestController
@RequestMapping("power-strip")
public class PowerStripController {
    /**
     * 服务对象
     */
    @Autowired
    private PowerStripService powerStripService;

    @PostMapping("/pagination-query")
    @Operation(summary = "分页查询排插信息")
    public Result<Page<PowerStrip>> paginationQuery(@RequestBody PageDto pageDto) {
        Page<PowerStrip> powerStripPage = new Page<>(pageDto.getCurrentPage() <= 0 ? 1 : pageDto.getCurrentPage(), pageDto.getPageSize() <= 0 ? 10 : pageDto.getPageSize());
        Page<PowerStrip> page = powerStripService.page(powerStripPage);
        return Result.success(page);
    }
}

